home *** CD-ROM | disk | FTP | other *** search
/ Sprite 1984 - 1993 / Sprite 1984 - 1993.iso / src / lib / include / sys / RCS / mman.h,v < prev    next >
Text File  |  1991-04-09  |  4KB  |  171 lines

  1. head     1.2;
  2. branch   ;
  3. access   ;
  4. symbols  ;
  5. locks    ; strict;
  6. comment  @ * @;
  7.  
  8.  
  9. 1.2
  10. date     91.04.09.18.33.11;  author shirriff;  state Exp;
  11. branches ;
  12. next     1.1;
  13.  
  14. 1.1
  15. date     91.04.09.16.43.23;  author shirriff;  state Exp;
  16. branches ;
  17. next     ;
  18.  
  19.  
  20. desc
  21. @@
  22.  
  23.  
  24. 1.2
  25. log
  26. @Mary checking this in for Ken since I have to reinstall vm.
  27. @
  28. text
  29. @/*
  30.  * Copyright (c) 1991 Regents of the University of California.
  31.  * All rights reserved.  The Berkeley software License Agreement
  32.  * specifies the terms and conditions for redistribution.
  33.  *
  34.  */
  35.  
  36. #ifndef _MMAN
  37. #define _MMAN
  38.  
  39. /*
  40.  * Protection flags.
  41.  */
  42. #define PROT_READ    0x4    /* Read permissions. */
  43. #define PROT_WRITE    0x2    /* Write permissions. */
  44. #define PROT_EXEC    0x1    /* Exec permissions. */
  45. /*
  46.  * For no good reason, Sun and Sequent have the flags in the reverse order.
  47.  */
  48. #define SUN_PROT_READ    0x1    /* Read permissions. */
  49. #define SUN_PROT_WRITE    0x2    /* Write permissions. */
  50. #define SUN_PROT_EXEC    0x4    /* Exec permissions. */
  51.  
  52. #define PROT_RDWR    (PROT_READ|PROT_WRITE)
  53. #define PROT_BITS    (PROT_READ|PROT_WRITE|PROT_EXEC)
  54.  
  55. /*
  56.  * Sharing flags.
  57.  */
  58. #define MAP_SHARED    1    /* Share modifications. */
  59. #define MAP_PRIVATE    2    /* Keep modifications private. */
  60. #define MAP_ZEROFILL    3    /* Zerofill pages. */
  61. #define MAP_TYPE    0xf    /* Mask for type. */
  62.  
  63. #define MAP_FIXED    0x10    /* Force mapping to user's address. */
  64.  
  65. #define _MAP_NEW    0x80000000 /* Return address instead of 0. */
  66.  
  67. #endif _MMAN
  68. @
  69.  
  70.  
  71. 1.1
  72. log
  73. @Initial revision
  74. @
  75. text
  76. @a0 12
  77. /* $Copyright:    $
  78.  * Copyright (c) 1984, 1985, 1986, 1987 Sequent Computer Systems, Inc.
  79.  * All rights reserved
  80.  *  
  81.  * This software is furnished under a license and may be used
  82.  * only in accordance with the terms of that license and with the
  83.  * inclusion of the above copyright notice.   This software may not
  84.  * be provided or otherwise made available to, or used by, any
  85.  * other person.  No title to or ownership of the software is
  86.  * hereby transferred.
  87.  */
  88.  
  89. d2 3
  90. a4 1
  91.  * $Header: mman.h 2.10 87/04/06 $
  92. a5 2
  93.  * mman.h
  94.  *    Structures and definitions for memory mapping support.
  95. d8 2
  96. a9 2
  97. /* $Log:    mman.h,v $
  98.  */
  99. d12 1
  100. a12 5
  101.  * mmap() system-call interface definitions.
  102.  *
  103.  * In the current implementation:
  104.  *    PROT_WRITE ==> PROT_READ.
  105.  *    PROT_EXEC insists on PROT_READ, and arranges caching of the map.
  106. d14 3
  107. a16 15
  108.  
  109. #include <sys/types.h>
  110. #define    PROT_READ    0x4        /* read access */
  111. #define    PROT_WRITE    0x2        /* write access */
  112. #define    PROT_EXEC    0x1        /* executable access */
  113.  
  114. #define    PROT_RDWR    (PROT_READ|PROT_WRITE)
  115. #define    PROT_BITS    (PROT_READ|PROT_WRITE|PROT_EXEC)
  116.  
  117. #define    PROT_LASTFD    0x8        /* internal state, orthog to above */
  118.  
  119. #define    MAP_SHARED    1        /* shared modifications */
  120. #define    MAP_PRIVATE    2        /* private modifications */
  121. #define    MAP_ZEROFILL    3        /* pages are zero-filled, private */
  122.  
  123. d18 1
  124. a18 2
  125.  * Mapping operations structure -- defines a mapper.
  126.  * There is a set of map operations per type of file (eg, VREG, VCHR).
  127. d20 3
  128. d24 2
  129. a25 13
  130. struct    mapops    {
  131.     int    (*map_new)();        /* create a new map */
  132.     int    (*map_dup)();        /* dup ref to map (fork) */
  133.     int    (*map_unmap)();        /* release reference to map */
  134.     int    (*map_swpout)();    /* swap out ref to map */
  135.     int    (*map_swpin)();        /* swap in ref to map */
  136.     int    (*map_refpg)();        /* get ref to page */
  137.     int    (*map_derefpg)();    /* remove page ref */
  138.     int    (*map_realloc)();    /* drop reclaim link to page */
  139.     int    (*map_pgout)();        /* page-out page */
  140.     int    (*map_stat)();        /* get info about the map */
  141.     int    (*map_err)();        /* import an error to the map */
  142. };
  143. d28 1
  144. a28 6
  145.  * Per-process array of struct mmap keeps track of current mmap's.
  146.  * mm_pgcnt < mm_size if some pages are unmapped or re-mapped.
  147.  * mm_pgcnt == 0 ==> entry is unused.
  148.  *
  149.  * mm_prot holds maximimum possible protection mapped by this entry; must
  150.  * have enough bits to fit PROT_BITS.
  151. d30 8
  152. d39 1
  153. a39 16
  154. struct    mmap    {
  155.     u_long        mm_off;        /* 1st file offset mapped (HW pages) */
  156.     size_t        mm_1stpg;    /* 1st vpn in process */
  157.     size_t        mm_size;    /* size mapped (HW pages) */
  158.     size_t        mm_pgcnt;    /* # HW pages mapped */
  159.     struct    mapops    *mm_ops;    /* mapper operations */
  160.     u_long        mm_handle;    /* identifies mapped object */
  161.     short        mm_fdidx;    /* fd index mapped */
  162.     char        mm_prot;    /* "prot" bits mapped by this entry */
  163.     u_char        mm_paged: 1,    /* paged? else phys */
  164.             mm_noio:  1,    /* IO services prohibited? */
  165.             mm_lastfd:1,    /* last fd ref is getting closed */
  166.             mm_cor:   1,    /* copy-on-ref these pages */
  167.             mm_text:  1,    /* is this a "text" map? */
  168.                 : 3;    /* reserved */
  169. };
  170. @
  171.